使用指紋觸控進行目前的操作
import LocalAuthentication
let context = LAContext()
context.localizedCancelTitle = "取消"
var error: NSError?
if contetxt.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) {
if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) {
let reason = "登入以使用"
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason) { success, error in
if success {
DispatchQueue.main.async {
print("登入成功")
}
login = true
} else {
DispatchQueue.main.async {
print("登入失敗")
}
}
}
} else {
// 顯示Error訊息
}